package com.iwayin.web.action.top;

import java.util.List;

import com.iwayin.core.bo.ask.AskBO;
import com.iwayin.core.bo.comment.CommentBO;
import com.iwayin.core.bo.fans.FansBO;
import com.iwayin.core.bo.follow.FollowBO;
import com.iwayin.core.bo.user.UserBO;
import com.iwayin.core.common.Constants;
import com.iwayin.core.dataobject.UserDO;
import com.iwayin.web.action.BaseAction;
/**
 * 用户排行榜
 * @author xiaobo.feng<xiaobo.feng@foxmail.com>
 *
 * Mar 28, 2012
 */
public class TopUserAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = -2911022267758717704L;
	
	private UserBO userBO;
	private FansBO fansBO;
	private AskBO askBO;
	private CommentBO commentBO;
	private FollowBO followBO;
	private List<UserDO> userList;
	private Long size;//展示数量
	private UserDO query;
	/**
	 * 获取当天粉丝最多的TOP用户
	 * @return
	 */
	public String topFansToday(){
		if(size==null){
			size = Constants.USER_TOP_SIZE;
		}
		userList = fansBO.findFansMostToday(size);
		return SUCCESS;
	}
	/**
	 * 获得当天关注最多的TOP用户
	 * @return
	 */
	public String topFollowToday(){
		if(size==null){
			size = Constants.USER_TOP_SIZE;
		}
		userList = followBO.findFollowMostToday(size);
		return SUCCESS;
	}
	/**
	 * 获取当天ask最多top用户
	 * @return
	 */
	public String topAskToday(){
		if(size==null){
			size = Constants.USER_TOP_SIZE;
		}
		userList = askBO.findAskMostToday(size);
		return SUCCESS;
	}
	/**
	 * 获取当天answer最多top用户
	 * @return
	 */
	public String topAnswerToday(){
		if(size==null){
			size = Constants.USER_TOP_SIZE;
		}
		return SUCCESS;
	}
	/**
	 * 当天评论最多top用户
	 * @return
	 */
	public String topCommentToday(){
		if(size==null){
			size = Constants.USER_TOP_SIZE;
		}
		userList = commentBO.findMostCommentToday(size);
		return SUCCESS;
	}
	/**
	 * 用户列表,支持fanscount、followcount、askcount排序
	 * @return
	 */
	public String listUsers(){
		userList = userBO.listUser(query);
		return SUCCESS;
	}
	
	public List<UserDO> getUserList() {
		return userList;
	}
	public void setUserBO(UserBO userBO) {
		this.userBO = userBO;
	}

	public void setFansBO(FansBO fansBO) {
		this.fansBO = fansBO;
	}

	public void setSize(Long size) {
		this.size = size;
	}

	public void setFollowBO(FollowBO followBO) {
		this.followBO = followBO;
	}
	public void setAskBO(AskBO askBO) {
		this.askBO = askBO;
	}
	public UserDO getQuery() {
		return query;
	}
	public void setQuery(UserDO query) {
		this.query = query;
	}
	public void setCommentBO(CommentBO commentBO) {
		this.commentBO = commentBO;
	}
	
}
